 package net.ruixin.web.struts2;

 import com.opensymphony.xwork2.ModelDriven;
 import com.opensymphony.xwork2.Preparable;

 public abstract class CRUDActionSupport<T> extends SimpleActionSupport
   implements ModelDriven<T>, Preparable
 {
   public static final String RELOAD = "reload";

   public String execute()
     throws Exception
   {
     return list();
   }

   public abstract String list()
     throws Exception;

   public abstract String save()
     throws Exception;

   public abstract String delete()
     throws Exception;

   public void prepareSave()
     throws Exception
   {
     prepareModel();
   }

   public void prepareInput()
     throws Exception
   {
     prepareModel();
   }

   public void prepare()
     throws Exception
   {
   }

   protected abstract void prepareModel()
     throws Exception;
 }
